﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.Common;
namespace lcreport.Web
{
    public partial class reg : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnreg_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            { 
                string code = txtCode.Text.Trim();
                if (Session["CheckCode"] != null && code.ToLower() == Session["CheckCode"].ToString().ToLower())
                {
                    string uname = this.txtuname.Text;
                    string upwd = this.txtupwd.Text;
                    string utruename = this.txtutruename.Text;
                    string usex = "男";
                    if (rdbwoman.Checked) usex = "女";
                    string udiqu = this.txtudiqu.Text;
                    string uadd = this.txtuadd.Text;
                    string uemail = this.txtuemail.Text;
                    string utel = this.txtutel.Text;
                    string uCID = this.txtuCID.Text;

                    lcreport.Model.userinfo model = new lcreport.Model.userinfo();
                    model.uname = uname;
                    model.upwd = upwd;
                    model.utruename = utruename;
                    model.usex = usex;
                    model.udiqu = udiqu;
                    model.uadd = uadd;
                    model.uemail = uemail;
                    model.utel = utel;
                    model.uCID = uCID;

                    lcreport.BLL.userinfo bll = new lcreport.BLL.userinfo();
                    int i = bll.Add(model);
                    if (i > 0)
                        Maticsoft.Common.MessageBox.ShowAndRedirect(this, "注册成功！", "login.aspx");
                    else
                        Maticsoft.Common.MessageBox.Show(this, "用户名存在！");
                }
            }

        }

        protected void btnback_Click(object sender, EventArgs e)
        {
            Response.Redirect("xz.aspx");
        }
    }
}